package threading;

import java.util.Scanner;

public class Day11 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            int tempCount = 0;
            int count = 0;
            while(n!=0){
                if((n&1)==1){
                    tempCount++;
                    count=Math.max(count,tempCount);
                }else{
                    tempCount = 0;
                }
                n=n>>1;
            }
            System.out.println(count);
        }

    }
}
